<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="_token" content="{{ csrf_token() }}"/>
    <title>宏邦客户绑定</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="{{asset('admin_assets/css/bootstrap.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/font-awesome/css/font-awesome.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/AdminLTE.min.css')}}">
    <link rel="stylesheet" href="{{asset('css/bootstrap-social.css')}}">
    <link rel="stylesheet" href="{{asset('css/bootstrap-theme.min.css')}}">
    <link rel="stylesheet" href="{{asset('css/templatemo_style.css')}}">
    <link rel="stylesheet" href="{{asset('css/wechat_login.css')}}">
</head>
<body>
<div class="row" id="particles-js" style="overflow: hidden;margin-left: 0">
    <div class="col-md-6 background" style="overflow: hidden">
        <img src="{{asset('admin_assets/img/iplogo.png')}}" style="width: 280px;height: 66px;margin-bottom: 15%">
        <br>
        <form class="form-horizontal templatemo-container templatemo-login-form-1 margin-bottom-30" role="form" action="#" onsubmit="return false" method="post" enctype="multipart/form-data">
            {{ csrf_field() }}
            <div class="row" style="margin-top: 5%">
                <div class="col-sm-12 col-xs-12">
                    <div class="wechat-box">
                        <i class="fa fa-user fa-lg ico"></i>
                        <input type="text" id="account" name="account" class="wechat-input" placeholder="账号:">
                    </div>
                </div>
            </div>
            <div class="row" style="margin-top: 10%">
                <div class="col-sm-12 col-xs-12">
                    <div class="wechat-box">
                        <i class="fa fa-unlock-alt fa-lg ico"></i>
                        <input type="password" id="password" name="password" class="wechat-input" placeholder="密码:">
                    </div>
                </div>
            </div>
            <div class="row" style="margin-top: 10%">
                <div class="col-sm-12 col-xs-12">
                    <div class="wechat-box">
                        <input type="button" id="btn" name="btn" class="wechat-input" placeholder="绑定" value="绑定">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div id="footer">
        Copyright &copy; {{date("Y",time())}} <a href="http://www.hongbung.com" target="_blank">上海宏邦知识产权代理有限公司</a>
    </div>
</div>
</body>
<script src="{{asset('admin_assets/js/jquery.min.js')}}"></script>
<script src="{{asset('admin_assets/js/bootstrap.min.js')}}"></script>
<script src="{{asset('js/particles.js')}}"></script>
<script>
    particlesJS('particles-js', {
        particles: {
            color: '#eaffff',
            shape: 'circle',
            opacity: 1,
            size: 2,
            size_random: true,
            nb: 50,
            line_linked: {
                enable_auto: true,
                distance: 100,
                color: '#eafdff',
                opacity: 1,
                width: 2,
                condensed_mode: {
                    enable: false,
                    rotateX: 600,
                    rotateY: 600
                }
            },
            anim: {
                enable: true,
                speed:2
            }
        },
        interactivity: {
            enable: true,
            mouse: {
                distance: 250
            },
            detect_on: 'canvas',
            mode: 'grab',
            line_linked: {
                opacity: .5
            },
            events: {
                onclick: {
                    enable: true,
                    mode: 'push',
                    nb: 4
                }
            }
        },
        retina_detect: true
    });



    $("#btn").click(function () {
        var account=$("#account").val();
        var password=$("#password").val();
        var formData = new FormData();
        formData.append("password" , password);
        formData.append("account" , account);
        $.ajax({
            url:'{{route("WeChat.wechatService.bindAccount")}}',
            data: formData,
            processData : false,
            contentType : false ,
            type:'post',
            headers: {
                'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
            },
            success:function (data) {
                $returnData=JSON.parse(data);
                alert($returnData.message);
                if($returnData.code==0){
                    window.location.href="{{route("WeChat.wechatService.unbind")}}"+"?account="+$returnData.data.account
                    +"&account_id="+$returnData.data.account_id;
                }
            },
            error:function (XMLHttpRequest, textStatus, errorThrown) {

                alert("绑定信息失败");
                window.location.reload();
            }
        });
    });


</script>
</body>
</html>
